package main

import (
	"GINCHAT/modules"
	"fmt"
	"github.com/spf13/viper"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

func main() {
	viper.SetConfigName("app")
	viper.AddConfigPath("config")
	viper.ReadInConfig()
	get := viper.GetString("mysql.dns")
	fmt.Println(get)
	db, err := gorm.Open(mysql.Open(get), &gorm.Config{})

	if err != nil {
		fmt.Println("我去。。。连接数据库都出错了你在干啥哦")

	}
	db.AutoMigrate(&modules.UserBasic{})

}
